package net.mycrub.bitwise.core;


public interface ILayer extends Cloneable {

    /**
     * Processes a vector of input.
     * 
     * @param input
     *            the layer input to be processed by the layer
     * @param callback
     *            the callback where the retroaction will be injected (if any)
     *            by the layer
     * @return the output computed from the input and the layer implementation
     *         After this method has been called, a retroaction has been
     *         injected in the callback
     */
    double[] process(double[] input, IRetroActionCallback callback);

    /**
     * Processes a vector of input.
     * 
     * @param input
     *            the layer input to be processed by the layer
     * @return the output computed from the input and the layer implementation
     *         No retroaction can be used.
     */
    double[] process(double[] input);

    /**
     * Triggers a mutation in the layer. Behaviour depends on the layer
     * implementation.
     */
    void mutate();

    /**
     * Creates a new layer by (genetic) combination of this layer with a partner
     * 
     * @param partner
     *            the partner with whom to be combined
     * @return a "child" layer
     */
    ILayer combine(ILayer partner);

    /**
     * Clones this layer
     * 
     * @return an exact copy of this layer
     */
    ILayer duplicate();

    /**
     * Gives the expected size of the input vector to be used with the process
     * method
     * 
     * @return the input vector size
     */
    int getInputSize();

    /**
     * Gives the size of the output vector returned by the process method
     * 
     * @return the output vector size
     */
    int getOutputSize();

}
